load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")

go_library(
    name = "importer_lib",
    srcs = [
        "config.go",
        "data.go",
        "db.go",
        "job.go",
        "main.go",
        "parser.go",
        "rand.go",
        "stats.go",
    ],
    importpath = "github.com/pingcap/tidb/cmd/importer",
    visibility = ["//visibility:private"],
    deps = [
        "//pkg/ddl",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/planner/core",
        "//pkg/statistics",
        "//pkg/statistics/handle/storage",
        "//pkg/statistics/handle/util",
        "//pkg/types",
        "//pkg/util/mathutil",
        "//pkg/util/mock",
        "@com_github_burntsushi_toml//:toml",
        "@com_github_go_sql_driver_mysql//:mysql",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_log//:log",
        "@org_uber_go_zap//:zap",
    ],
)

go_binary(
    name = "importer",
    embed = [":importer_lib"],
    visibility = ["//visibility:public"],
)

go_test(
    name = "importer_test",
    timeout = "short",
    srcs = ["db_test.go"],
    embed = [":importer_lib"],
    flaky = True,
)
